<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<SCRIPT language="JavaScript1.2">
function openwindow()
{
  window.open("http://www.javascript-coder.com","mywindow","menubar=1,resizable=1,width=350,height=250");
}
</SCRIPT>
<div class="list">
<table>
  <tr>
    <th>No.</th>
    <th>S</th>
    <th width="300">Message</th>
    <th>Annotations</th>
  </tr>
    <c:forEach items="${conversation.messages}" var="message">
    <tr>
      <td><c:out value="${message.sequence}" /></td>
      <td><c:if test="${message.speaker == 1}">
        <font style="color: red">L</font>
      </c:if> <c:if test="${message.speaker == 2}">
        <font style="color: blue">U</font>
      </c:if></td>
      <td><c:out escapeXml="false" value="${message.contentString}" /> <br /> <br />

      <c:if test="${message.note != ''}">
        <a title="Note: <c:out value='${message.note}'/>">[note]</a>
      </c:if>
      <c:if test="${anno_user.role == 1}">       
       <a href='annotatemessage.html?messageId=<c:out value="${message.messageId}"/>'>[annotate]</a>
       <a href='enterda.html?messageId=<c:out value="${message.messageId}"/>'>[new]</a>
     </c:if>
     <% if (request.getParameter("mode").equals("browse")) { %>
       <a href='browsemessage.html?messageId=<c:out value="${message.messageId}"/>'>[browse]</a>
     <% } else { %>
       <a href='annotatemessage.html?messageId=<c:out value="${message.messageId}"/>'>[annotate]</a>
       <a href='enterda.html?messageId=<c:out value="${message.messageId}"/>'>[new]</a>
     <% } %>       
      </td>
      <td>
        <!-- 
          --  Annotations  
          -->
        <table class="NoBorders">
          <c:forEach items="${conversation.assignments}" var="assignment">
          <tr>
            <!-- 
              -- Annotator 
              -->
          	<td class="UserName"><c:out value="${assignment.user.userName}"></c:out></td>
            
          	<td>
          	  	<c:forEach items="${message.sortedDialogueActs}" var="da">
          	      <c:if test="${da.user.userId == assignment.user.userId}">
                    <table class="NoBorders">
                      <tr>
          		          <!--  td class='<c:out value="${da.function.labelClass}"/>' -->
          		          <td class='TextSegmentSnippet'>
            			        <c:out value="${da.textSegmentSnippet}" /> 
            			      </td>
                  		  <td class='DAFunction'> 
         		              <span class='<c:out value="${da.function.labelClass}"/>'><c:out value="${da.function.label}" /></span>
         		            </td>
          	            <td class='DADomain'>
            		          <c:if test="${da.domain != null}">   
									          <span class='<c:out value="${da.function.labelClass}"/>'><c:out value="${da.domain.label}" />	</span>						
              	          </c:if>              	        
                        </td>
                        <td>
                        	<c:if test="${da.numExactlyMatched > 0}"><font style="font-weight: 900; color:green">&#x2713</font></c:if>
                        	<c:if test="${da.numExactlyMatched == 0 && da.numMatched > 0}"><font style="font-weight: 900; color:blue">&#x2713</font></c:if>
                        	<c:if test="${da.numExactlyMatched == 0 && da.numMatched == 0 && da.numFunctionMatched > 0}"><font style="font-weight: 900; color:black">!</font></c:if>
                        	<c:if test="${da.numExactlyMatched == 0 && da.numMatched == 0 && da.numFunctionMatched == 0}"><font style="font-weight: 900; color:red">!</font></c:if>
                        </td>
                        <td>
                          <a href='enterda.html?messageId=<c:out value="${message.messageId}"/>&daId=<c:out value="${da.dialogueActId}"/>'>
                            [edit]
                          </a>
                          <a onClick="return confirmSubmit();" href="browseconversation.html?conversationId=<c:out value='${conversation.conversationId}'/>&delDaId=<c:out value='${da.dialogueActId}'/>">
                            [delete]                                 
                          </a>
                        </td>
	                    </tr>					            
				            </table>
				          </c:if>
                </c:forEach>                
            </td>
          </tr>
          </c:forEach>
        </table>
      </td>
    </tr>
    </c:forEach>
  </table>
</div>         
